// 1. 导入mongoose模块
const mongoose = require("mongoose");
// 2. 连接MongoDB数据库
mongoose.connect("mongodb://127.0.0.1:27017/booksdb");
// 3. 注册事件监听(可选)
mongoose.connection.on("open", () => {
    console.log("MongoDB数据库连接成功");
});

//将连接成功的mongoose导出
module.exports = mongoose;